package com.otod.sys.operater.log.service.impl;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.otod.base.service.BaseService;
import com.otod.commons.entity.Page;
import com.otod.sys.operater.log.bo.LogRecordBo;
import com.otod.sys.operater.log.mapper.AsmgOperaterLogMapper;
import com.otod.sys.operater.log.service.IOperaterLogService;
import com.otod.sys.vo.AsmgOperaterLogVo;
/**
 * 日志处理类
 * @author long
 *
 */
@Service(IOperaterLogService.BEAN_ID)
@Transactional(readOnly=true)
public class OperaterLogServiceImpl extends BaseService implements IOperaterLogService {

	@Autowired
	private AsmgOperaterLogMapper asmgOperaterLogMapper;
	/**
	 * 添加日志
	 */
	@Transactional
	public void addLog(AsmgOperaterLogVo asmgOperaterLogVo) {
		asmgOperaterLogVo.setUuid(super.getUUID());
		asmgOperaterLogMapper.insert(asmgOperaterLogVo);	
	}
	/**
	 * 通过时间批量删除日志
	 */
	@Transactional
	public void deleteLogTime(Date startTime, Date endTime) {
		Map<String, Object> map = new HashMap<String, Object>();

		map.put("startTime", startTime);
		map.put("endTime", endTime);
		asmgOperaterLogMapper.deleteTime(map);
		
	}
	/**
	 * 分页查询数据
	 */
	public Page queryPge(Page page, Map map) {
		
		List<AsmgOperaterLogVo> list =  asmgOperaterLogMapper.queryForList(page,map);
		page.setAaData(list); 
		return page;
	}
	/**
	 * 通过busiId查询数据
	 */
	public List<AsmgOperaterLogVo> queryRecord(Map<String, Object> map) {
		List<AsmgOperaterLogVo> list = asmgOperaterLogMapper.queryForList(map);
	
		return list;
	}

	

}
